<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"
	xmlns:hmrDetail="http://java.sun.com/jsf/composite/detail"
	xmlns:fn="http://java.sun.com/jsp/jstl/functions">

	<p:outputPanel id="viewPanel" layout="block">

		<p:outputPanel rendered="#{libraryBean.libraryViewType == 1}">
			<h:form id="libraryForm" prependId="false" style="height:100%">
				<h:panelGrid columns="2">
					<h:outputLabel value="#{msgs.Name}: " />
					<p:inputText value="#{libraryBean.library.name}" />
		
					<h:outputLabel value="#{msgs.Visibility}: "  /> 
					<p:selectOneMenu value="#{libraryBean.library.shareType}" >
						<f:selectItem itemLabel="#{msgs.SHARE_TYPE_PUBLIC}" 	itemValue="1"/>
						<f:selectItem itemLabel="#{msgs.SHARE_TYPE_AFFLIATES}" 	itemValue="2"/>
						<f:selectItem itemLabel="#{msgs.SHARE_TYPE_PERSONAL}" 	itemValue="3"/>
					</p:selectOneMenu>
		
					<h:outputLabel value="#{msgs.DefaultLibrary}: " /> 
					<p:selectBooleanCheckbox value="#{libraryBean.library.defaultLibrary}" /> 
		
					<h:outputLabel value="#{msgs.ModalitysTotal}: "/>
					<h:outputLabel value="#{fn:length(libraryBean.library.modalitys)}"/>
			
					<h:outputLabel value="#{msgs.TrainingSystemsTotal}: " />
					<h:outputLabel value="#{fn:length(libraryBean.library.trainingSystems)}"/>
		
					<h:outputLabel value="#{msgs.TrainingsTotal}: " />
					<h:outputLabel value="#{fn:length(libraryBean.library.trainings)}"/>
		
					<h:outputLabel value="#{msgs.ExerciseGroupsTotal}: " />
					<h:outputLabel value="#{fn:length(libraryBean.library.exerciseGroups)}"/>
		
					<h:outputLabel value="#{msgs.EquipmentsTotal}: " />
					<h:outputLabel value="#{fn:length(libraryBean.library.equipments)}"/>
				</h:panelGrid>
				<div align="left"   >
					<p:commandButton  value="#{msgs.Save}"		action="#{libraryBean.saveLibrary}"		
						update=":growl, :content, :listLibraryForm"		icon="ui-icon-disk"	rendered="#{libraryBean.library.id != null}" />

					<p:commandButton  value="#{msgs.Create}"	action="#{libraryBean.createLibrary}"	
						update=":growl, :content, :listLibraryForm"		icon="ui-icon-document"	rendered="#{libraryBean.library.id == null}" />
					<p:spacer width="50px"/>	
					<p:commandButton  value="#{msgs.Cancel}"	action="#{libraryBean.cancelChange}"	 
						update=":growl, :content, :listLibraryForm"		icon="ui-icon-cancel" />
				</div>	
			</h:form>			
		</p:outputPanel>					
	
		<p:outputPanel rendered="#{libraryBean.libraryViewType == 2}">
			<hmrDetail:modalityDetails handler="#{libraryBean.modalityDetailsComp}" editable="false"/>
		</p:outputPanel>	

		<p:outputPanel rendered="#{libraryBean.libraryViewType == 3}">
			<hmrDetail:trainingDetails handler="#{libraryBean.trainingDetailsComp}" editable="false"/>
		</p:outputPanel>
				
		<p:outputPanel rendered="#{libraryBean.libraryViewType == 4}">
			<hmrDetail:trainingSystemDetails handler="#{libraryBean.trainingSystemDetailsComp}" editable="false" />
		</p:outputPanel>

		<p:outputPanel rendered="#{libraryBean.libraryViewType == 5}">
			<hmrDetail:exerciseGroupDetails handler="#{libraryBean.exerciseGroupDetailsComp}" editable="false"/>
		</p:outputPanel>	

		<p:outputPanel rendered="#{libraryBean.libraryViewType == 6}">
			<hmrDetail:equipmentDetails handler="#{libraryBean.equipmentDetailsComp}" editable="false"/>
		</p:outputPanel>	

		<p:outputPanel rendered="#{libraryBean.libraryViewType == 7}">
			<hmrDetail:equipmentDetails handler="#{libraryBean.equipmentDetailsComp}" editable="false"/>
		</p:outputPanel>	

	</p:outputPanel>	
</html>